#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int n=0, m=0, i=0;
	int a[100] = {0};
	int b[100] = {0};
	int index1=0;
	int index2=0;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	scanf("%d", &m);
	for (i = 0; i < m; i++)
	{
		scanf("%d", &b[i]);
	}
	while (1)
	{
		if (n == index1)
		{
			for (index2; index2 < m; index2++)
			{
				printf("%d ", b[index2]);
			}
			break;
		}
		if (m == index2)
		{
			for (index1; index1 < n; index1++)
			{
				printf("%d ", a[index1]);
			}
			break;
		}
		if (a[index1] >= b[index2])
		{
			printf("%d ", a[index1]);
			index1++;
		}
		else
		{
			printf("%d ", b[index2]);
			index2++;
		}
		if (n== index1 && m == index2)
		{
			break;
		}
	}
	return 0;
}